package com.example.snakegame
import LeaderboardAdapter
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager

import com.example.snakegame.databinding.ActivityLeaderboardBinding
import com.example.snakegame.utils.SharedPreferencesManager

class LeaderboardActivity : AppCompatActivity() {
    private lateinit var binding: ActivityLeaderboardBinding
    private lateinit var prefsManager: SharedPreferencesManager
    private lateinit var adapter: LeaderboardAdapter

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this, R.layout.activity_leaderboard)
        
        prefsManager = SharedPreferencesManager(this)
        setupRecyclerView()
    }

    private fun setupRecyclerView() {
        adapter = LeaderboardAdapter(prefsManager.getScores())
        binding.leaderboardRecyclerView.apply {
            adapter = this@LeaderboardActivity.adapter
            layoutManager = LinearLayoutManager(this@LeaderboardActivity)
        }
    }
} 